<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>华悦假日酒店 | 后台</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="icon" href="../images/favicon.jpg" sizes="32x32">
    <link rel="stylesheet" href="../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../layuiadmin/style/admin.css" media="all">

</head>
<body class="layui-layout-body">

<div id="LAY_app">
    <div class="layui-layout layui-layout-admin">
        <!-- 头部区域 -->
        <div class="layui-header">
            <ul class="layui-nav layui-layout-left">
                <li class="layui-nav-item layadmin-flexible" lay-unselect>
                    <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
                        <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="/" target="_blank" title="前台">
                        <i class="layui-icon layui-icon-website"></i>
                    </a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;" layadmin-event="refresh" title="刷新">
                        <i class="layui-icon layui-icon-refresh-3"></i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a id="time1" href="javascript:void(0)">

                    </a>
                </li>
            </ul>
            <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
                <!--<li class="layui-nav-item" lay-unselect>-->
                <!--<a lay-href="app/message/index.html" layadmin-event="message" lay-text="消息中心">-->
                <!--<i class="layui-icon layui-icon-notice"></i>-->
                <!--&lt;!&ndash; 如果有新消息，则显示小圆点 &ndash;&gt;-->
                <!--<span class="layui-badge-dot"></span>-->
                <!--</a>-->
                <!--</li>-->
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="theme">
                        <i class="layui-icon layui-icon-theme"></i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="note">
                        <i class="layui-icon layui-icon-note"></i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="fullscreen">
                        <i class="layui-icon layui-icon-screen-full"></i>
                    </a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        <img id="userIcon" src="/download/icon.jpg" width="20px" height="20px">

                        <cite id="userName"></cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a lay-href="set/user/info.html">基本资料</a></dd>
                        <dd><a lay-href="set/user/password.html">修改密码</a></dd>
                        <hr>
                        <dd style="text-align: center;"><a href="javascript:;" onclick="userExit()">退出</a></dd>
                    </dl>
                </li>
            </ul>
        </div>

        <!-- 侧边菜单 -->
        <div class="layui-side layui-side-menu">
            <div class="layui-side-scroll">
                <div class="layui-logo" lay-href="tool/welcome.html">
                    <span>华悦假日酒店</span>
                </div>
                <script type="text/html" template
                        lay-url="/menu/findMenuByUser"
                        lay-done="layui.element.render('nav', 'layadmin-system-side-menu');" id="TPL_layout">
                    <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu"
                        lay-filter="layadmin-system-side-menu">
                        {{#
                        var path = layui.router().path
                        ,dataName = layui.setter.response.dataName;

                        layui.each(d[dataName], function(index, item){
                        var hasChildren = typeof item.list === 'object' && item.list.length > 0
                        ,classSelected = function(){
                        if(index == 0){
                        return hasChildren ? 'layui-nav-itemed' : 'layui-this';
                        }
                        return '';
                        }
                        ,url = typeof item.href === 'string' ? item.href : item.name;
                        }}
                        <li data-name="{{ item.name || '' }}" data-jump="{{ item.href || '' }}"
                            class="layui-nav-item {{ classSelected() }}">
                            <a href="javascript:;" {{ hasChildren ? '' : 'lay-href="'+ url +'"' }}
                            lay-tips="{{item.title }}" lay-direction="2">
                            <i class="layui-icon {{ item.icon }}"></i>
                            <cite>{{ item.title }}</cite>
                            </a>
                            {{# if(hasChildren){ }}
                            <dl class="layui-nav-child">
                                {{# layui.each(item.list, function(index2, item2){
                                var hasChildren2 = typeof item2.list == 'object' && item2.list.length > 0
                                ,classSelected2 = function(){
                                if(index==0){
                                return hasChildren2 ? 'layui-nav-itemed' : 'layui-this';
                                }
                                return '';
                                }
                                ,url2 = typeof item2.href === 'string'
                                ? item2.href
                                : [item.name, item2.name, ''].join('/');
                                }}
                                <dd data-name="{{ item2.name || '' }}" data-jump="{{ item2.href || '' }}" {{
                                    classSelected2() ? (
                                'class="'+ classSelected2() +'"') : '' }}>
                                <a href="javascript:;" {{ hasChildren2 ? '' : 'lay-href="'+ url2 +'"' }}>{{ item2.title
                                }}</a>
                                {{# if(hasChildren2){ }}
                                <dl class="layui-nav-child">
                                    {{# layui.each(item2.list, function(index3, item3){
                                    var match = path[0] == item.name && path[1] == item2.name && path[2] == item3.name
                                    ,url3 = typeof item3.href === 'string'
                                    ? item3.href
                                    : [item.name, item2.name, item3.name].join('/')
                                    }}
                                    <dd data-name="{{ item3.name || '' }}" data-jump="{{ item3.href || '' }}"
                                        {{ match ?
                                    'class="layui-this"' : '' }}>
                                    <a href="javascript:;" lay-href="{{ url3 }}">{{ item3.title }}</a>
                                    </dd>
                                    {{# }); }}
                                </dl>
                                {{# } }}
                                </dd>
                                {{# }); }}
                            </dl>
                            {{# } }}
                        </li>
                        {{# }); }}
                    </ul>
                </script>
            </div>
        </div>

        <!-- 页面标签 -->
        <div class="layadmin-pagetabs" id="LAY_app_tabs">
            <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-down">
                <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;"></a>
                        <dl class="layui-nav-child layui-anim-fadein">
                            <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
                            <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
                            <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
            <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
                <ul class="layui-tab-title" id="LAY_app_tabsheader">
                    <li lay-id="tool/welcome.html" lay-attr="tool/welcome.html" class="layui-this">
                        <i class="layui-icon layui-icon-home"></i>
                    </li>
                </ul>
            </div>
        </div>

        <!-- 主体内容 -->
        <div class="layui-body" id="LAY_app_body">
            <div class="layadmin-tabsbody-item layui-show">
                <iframe class="layadmin-iframe" src="tool/welcome.html" frameborder="0"></iframe>
            </div>
        </div>
        <!-- 辅助元素，一般用于移动设备下遮罩 -->
        <div class="layadmin-body-shade" layadmin-event="shade"></div>
    </div>
</div>

<script src="../layuiadmin/layui/layui.js"></script>
<script src="../js/jquery-1.8.3.min.js"></script>
<script src="../js/jquery.cookie.min.js"></script>
<script>
    function datetime() {
        //创建日期时间对象
        var datetime = new Date();
        //获取组件
        var year = datetime.getFullYear();
        var month = datetime.getMonth() + 1;
        var day = datetime.getDate();
        var hour = datetime.getHours();
        var minute = datetime.getMinutes();
        var second = datetime.getSeconds();
        var week = datetime.getDay();
        //转换星期格式
        switch (week) {
            case 0:
                var week = '星期日';
                break;
            case 1:
                var week = '星期一';
                break;
            case 2:
                var week = '星期二';
                break;
            case 3:
                var week = '星期三';
                break;
            case 4:
                var week = '星期四';
                break;
            case 5:
                var week = '星期五';
                break;
            case 6:
                var week = '星期六';
                break;
        }

        //小时,分钟,秒如果小于10加上前导零
        if (hour < 10) {
            var hour = 0 + "" + hour;
        }
        if (minute < 10) {
            var minute = 0 + "" + minute;
        }
        if (second < 10) {
            var second = 0 + "" + second;
        }
        //完整时间
        var now = year + "年" + month + "月" + day + "日" + " " + hour + ":" + minute + ":" + second + " " + week;
        //更新内容
        $("#time1").text(now);//这里是往p标签中添加
    }

    setInterval(datetime, 1000);
</script>
<script>

    function userExit() {
        $.ajax({
            url: "/user/userExit",
            type: "get",
            dataType: "json",
            success: function (data) {
                $.removeCookie('userId', {path: '/'});
                layer.alert("退出成功", {icon: 1, time: 3000}, function (index) {
                    location.href = "user/login.html";
                    layer.close(index);
                });
            }
        })
    }

    $.ajax({
        url: "/user/findUserBySession",
        type: "get",
        dataType: "json",
        success: function (data) {
            document.cookie = "roleId=" + data.roleId;
            document.cookie = "userId=" + data.userId;

            $("#userName").text("【" + data.roleName + "】" + data.userName);
            if (data.userIcon != null) {
                $("#userIcon").attr("src", "/download/" + data.userIcon);
            }
        }
    })
    layui.config({
        base: '../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use('index');

</script>
</body>
</html>


